export default class BaseDate {
    /**
     * 格式化日期 格式化后：20170718
     *
     * @param{Date}date
     * @returns{string}
     * @memberofBaseDate
     */
    public formatDate(date: Date): string {
        const dateNow = date;
        const year: number = dateNow.getFullYear();
        let month: string | number = dateNow.getMonth() + 1;
        let day: string | number = dateNow.getDate();
        // return new Date(year, month, day);
        if (month < 10) {
            month = "0" + month;
        }
        if (day < 10) {
            day = "0" + day;
        }
        return year + "-" + month + "-" + day;
        // return new Date("yyyy-MM-dd");
    }

    public getDate() {
        return new Date();
    }
}
